home *** CD-ROM | disk | FTP | other *** search
- /*
- * @(#) nfsstat.c 12.1 95/05/09 SCOINC
- */
- /***************************************************************************
- *
- * Copyright (c) 1990-1993 The Santa Cruz Operation, Inc.
- *
- * All rights reserved. No part of this program or publication may be
- * reproduced, transmitted, transcribed, stored in a retrieval system,
- * or translated into any language or computer language, in any form or
- * by any means, electronic, mechanical, magnetic, optical, chemical,
- * biological, or otherwise, without the prior written permission of:
- *
- * The Santa Cruz Operation , Inc. (408) 425-7222
- * 400 Encinal St., Santa Cruz, California 95060 USA
- *
- **************************************************************************/
- /*
- * Modification History
- *
- * S002, 27-May-93, rickra
- * Added support for pixmaps....
- *
- * S001, 01-Jan-93, rickra
- * Added support for seperate windows
- *
- * S000, 30-Sep-92, rickra
- * Added copyright and modification history
- * Change hard coded color referneces to user configurable.
- */
- /*+-------------------------------------------------------------------------
- nfsstat.c - XSW NFS Stats display handler
-
-
- Defined functions:
- draw_nfsstat_literals(x,y)
- update_nfsstat()
-
- --------------------------------------------------------------------------*/
- #include <X11/Xlib.h>
- #include <X11/Xutil.h>
- #include <X11/Intrinsic.h>
- #include <X11/Shell.h>
- #include <Xm/Xm.h>
- #include <Xm/MainW.h>
- #include <Xm/DrawingA.h>
-
- #include "include/unixincs.h"
- #include "include/buttons.h"
- #include "include/xsw.h"
-
- int nfsstat_tlx;
- int nfsstat_tly;
-
- extern struct NetworkXswStruct *current_server;
-
-
- /*+-------------------------------------------------------------------------
- update_nfsstat()
- --------------------------------------------------------------------------*/
- void
- update_nfsstat (SP)
- struct NetworkXswStruct *SP;
-
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].pixmap;
-
-
- register int x, y;
- int fheight = FHEIGHT;
- char s80[100];
- unsigned long pixel;
- int i;
-
- pixel = colorNumeric.pixel;
-
- y = nfsstat_tly + fheight;
- x = nfsstat_tlx + Nfsstat1_TLX;
-
- sprintf (s80, "NFS client %% server %% RPC client");
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, s80);
- y += fheight;
-
-
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "calls ");
- y += fheight;
-
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "badcalls ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "nclget ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "nclsleep ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "null ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "getattr ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "setattr ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "root ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "lookup ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "readlink ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "read ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "wrcache ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "write ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "create ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "remove ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "rename ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "link ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "symlink ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "mkdir ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "rmdir ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "readdir ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "fsstat ");
- y += fheight;
-
- y = nfsstat_tly + (2 * fheight);
- x = nfsstat_tlx + Nfsstat2_TLX;
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> clstat.ncalls);
- y += fheight;
-
- if (current_server -> clstat.nbadcalls)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> clstat.nbadcalls);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> clstat.nbadcalls);
- y += fheight;
-
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> clstat.nclgets);
- y += fheight;
-
- if (current_server -> clstat.nclsleeps)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> clstat.nclsleeps);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> clstat.nclsleeps);
- y += fheight;
-
- for (i = 0; i < 18; i++)
- {
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> clstat.reqs[i]);
- y += fheight;
- }
-
-
- y = nfsstat_tly + (6 * fheight);
- x = nfsstat_tlx + Nfsstat3_TLX;
-
- if (current_server -> clstat.ncalls)
- {
-
- for (i = 0; i < 18; i++)
- {
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%3d", colorNumeric.pixel,
- ((current_server -> clstat.reqs[i] * 100) /
- current_server -> clstat.ncalls));
-
- y += fheight;
- }
-
- }
- else
- {
-
- for (i = 0; i < 18; i++)
- {
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%3d", colorNumeric.pixel, 0);
- y += fheight;
- }
-
- }
-
-
- y = nfsstat_tly + fheight;
- y += fheight;
- x = nfsstat_tlx + Nfsstat4_TLX;
-
- sprintf (s80, " N/A");
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> svstat.ncalls);
- y += fheight;
-
- if (current_server -> svstat.nbadcalls)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> svstat.nbadcalls);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> svstat.nbadcalls);
- y += fheight;
-
-
- disp_info_text (window, display, gc, DrawAreaXYWH, x, y, pixmap, pixel, s80);
- y += fheight;
- disp_info_text (window, display, gc, DrawAreaXYWH, x, y, pixmap, pixel, s80);
- y += fheight;
-
-
- for (i = 0; i < 18; i++)
- {
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> svstat.reqs[i]);
- y += fheight;
- }
-
- y = nfsstat_tly + (6 * fheight);
- x = nfsstat_tlx + Nfsstat5_TLX;
-
-
- if (current_server -> svstat.ncalls)
- {
-
- for (i = 0; i < 18; i++)
- {
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%3d", colorNumeric.pixel,
- ((current_server -> svstat.reqs[i] * 100) /
- current_server -> svstat.ncalls));
- y += fheight;
- }
-
- }
- else
- {
-
- for (i = 0; i < 18; i++)
- {
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%3d", colorNumeric.pixel, 0);
- y += fheight;
- }
-
- }
-
- y = nfsstat_tly + fheight;
- y += fheight;
- x = nfsstat_tlx + Nfsstat6_TLX;
-
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "fsstat ");
-
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "calls ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "badcalls ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "retrans ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "badxid ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "timeout ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "wait ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "newcred ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "peekerrs ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "badresps ");
-
- y = nfsstat_tly + fheight;
- y += fheight;
- x = nfsstat_tlx + Nfsstat7_TLX;
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rcstat.rccalls);
- y += fheight;
-
- if (current_server -> rcstat.rcbadcalls)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rcstat.rcbadcalls);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rcstat.rcbadcalls);
- y += fheight;
-
- if (current_server -> rcstat.rcretrans)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rcstat.rcretrans);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rcstat.rcretrans);
- y += fheight;
-
- if (current_server -> rcstat.rcbadxids)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rcstat.rcbadxids);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rcstat.rcbadxids);
- y += fheight;
-
- if (current_server -> rcstat.rctimeouts)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rcstat.rctimeouts);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rcstat.rctimeouts);
- y += fheight;
-
- if (current_server -> rcstat.rcwaits)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rcstat.rcwaits);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rcstat.rcwaits);
- y += fheight;
-
- if (current_server -> rcstat.rcnewcreds)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rcstat.rcnewcreds);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rcstat.rcnewcreds);
- y += fheight;
-
- if (current_server -> rcstat.rcpeekerrs)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rcstat.rcpeekerrs);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rcstat.rcpeekerrs);
- y += fheight;
-
- if (current_server -> rcstat.rcbadresponses)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rcstat.rcbadresponses);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rcstat.rcbadresponses);
-
- y += (2 * fheight);
- x = nfsstat_tlx + Nfsstat6_TLX;
-
-
- sprintf (s80, "RPC server");
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, s80);
- y += fheight;
-
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "calls ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "badcalls ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "nullrecv ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "badlen ");
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "xdrcall ");
- y += fheight;
-
- y = nfsstat_tly + (13 * fheight);
- x = nfsstat_tlx + Nfsstat7_TLX;
-
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rsstat.rscalls);
- y += fheight;
-
- if (current_server -> rsstat.rsbadcalls)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rsstat.rsbadcalls);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rsstat.rsbadcalls);
- y += fheight;
-
- if (current_server -> rsstat.rsnullrecv)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rsstat.rsnullrecv);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rsstat.rsnullrecv);
- y += fheight;
-
- if (current_server -> rsstat.rsbadlen)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rsstat.rsbadlen);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rsstat.rsbadlen);
- y += fheight;
-
- if (current_server -> rsstat.rsxdrcall)
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumericAlarm.pixel, current_server -> rsstat.rsxdrcall);
- else
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7d", colorNumeric.pixel, current_server -> rsstat.rsxdrcall);
- y += fheight;
-
-
- } /* end of update_Sysinfo */
-
- /*+-------------------------------------------------------------------------
- draw_nfsstat_literals(x,y,scale_name,val1_name,val2_name,val3_name)
- --------------------------------------------------------------------------*/
- void
- draw_nfsstat_literals (SP)
- struct NetworkXswStruct *SP;
-
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].pixmap;
-
- int x = 0;
- int y = 0;
-
- int x2 = x;
- int ys = y + FASCENT;
- int yl1 = y + (FASCENT / 2) + 1;
- int yl2 = y + (FHEIGHT / 2);
- int len;
- char *cptr;
- int fheight = FHEIGHT;
- int fwidth = FWIDTH;
- int line_style = LineSolid;
- int cap_style = CapButt;
- int join_style = JoinMiter;
-
-
-
- nfsstat_tlx = x;
- nfsstat_tly = y;
-
- /* the "background" color */
- XSetForeground (display, gc, colorTitleBarBG.pixel);
- XSetLineAttributes (display, gc, fheight,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc, x, yl2, x + (77 * fwidth), yl2);
- */
- XDrawLine (display, pixmap, gc, x, yl2, x + (77 * fwidth), yl2);
-
- /* "---------NFS Stats-----------------" */
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- XSetLineAttributes (display, gc, FASCENT / 2,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc,
- x2, yl1,
- x2 + (len = (fwidth * 5)) - FGAP, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl1,
- x2 + (len = (fwidth * 5)) - FGAP, yl1);
- x2 += len;
-
- cptr = "NFS Stats";
- /*
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- */
- XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
- x2 += (fwidth * len) + FGAP + 1;
- /*
- XDrawLine (display, window, gc, x2, yl1, x + (77 * fwidth), yl1);
- */
- XDrawLine (display, pixmap, gc, x2, yl1, x + (77 * fwidth), yl1);
-
-
- } /* end of draw_nfsstat_literals */
-
- /* vi: set tabstop=4 shiftwidth=4: */
- /* end of nfsstat.c */
-